//
// Source code recreated from a .class file by IntelliJ IDEA
// (powered by FernFlower decompiler)
//

package 力扣.题库.未分类;

public class demo_2595 {
    public demo_2595() {
    }

    public static void main(String[] args) {
        int[] a = evenOddBit(50);
        System.out.println(a[0] + "  " + a[1]);
    }

    public static int[] evenOddBit(int n) {
        int even = 0;
        int odd = 0;
        StringBuilder sb = (new StringBuilder(Integer.toBinaryString(n))).reverse();

        for(int i = 0; i < sb.length(); ++i) {
            if (i % 2 == 0 && sb.charAt(i) == '1') {
                ++even;
            }

            if (i % 2 == 1 && sb.charAt(i) == '1') {
                ++odd;
            }
        }

        return new int[]{even, odd};
    }
}
